package com.ltf.order.feign.fallback;

import com.alibaba.fastjson.JSONObject;
import com.ltf.order.feign.ProductFeignClient;
import com.ltf.product.pojo.ProductInfo;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * @Auther: liutf
 * @Date: 2025/3/27
 * @Description: com.ltf.order.interceptor.fallback
 * @version: 1.0
 */

@Component
public class ProductFeignClientFallback implements ProductFeignClient {
    @Override
    public JSONObject getProductById(Long id) {
        JSONObject obj = new JSONObject();
        obj.put("code", 500);
        obj.put("data", new ProductInfo(9999L,"兜底",new BigDecimal("9.999"),100));
        obj.put("message", "接口不通，触发兜底");
        return obj;
    }
}
